From 5709ce706e41a326f376eafebe34cffd7546fc36 Mon Sep 17 00:00:00 2001 From: Tim Starling Date: Tue, 15 Aug 2006 02:24:59 +0000 Subject: [PATCH] optionally remove comments in preprocess() --- includes/Parser.php | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/includes/Parser.php b/includes/Parser.php index 8ea10b34fe..2c94a67189 100644 --- a/includes/Parser.php +++ b/includes/Parser.php @@ -387,9 +387,10 @@ class Parser } /** - * Expand templates and variables in the text, producing valid, static wikitext + * Expand templates and variables in the text, producing valid, static wikitext. + * Also removes comments. */ - function preprocess( $text, $title, $options ) { + function preprocess( $text, $title, $options, $removeComments = true ) { wfProfileIn( __METHOD__ ); $this->clearState(); $this->setOutputType( OT_PREPROCESS ); @@ -399,6 +400,9 @@ class Parser wfRunHooks( 'ParserBeforeStrip', array( &$this, &$text, &$x ) ); $text = $this->strip( $text, $x ); wfRunHooks( 'ParserAfterStrip', array( &$this, &$text, &$x ) ); + if ( $removeComments ) { + $text = Sanitizer::removeHTMLcomments( $text ); + } $text = $this->replaceVariables( $text ); $text = $this->unstrip( $text, $x ); $text = $this->unstripNowiki( $text, $x ); -- 2.20.1